<template>
  <div>
    <h3>台区实时数据</h3>
    <x-button type="primary" @click.native="back">返回</x-button>
    <group class="cell-body">
      <cell v-if="data==undefined">暂无数据</cell>
    </group>
    <group class="cell-body">
      <cell title="时间">{{data.lassUpdateTime}}</cell>
      <cell title="归属地">{{data.location}}</cell>
      <cell title="台区号">{{data.areaNo}}</cell>
      <cell title="Ia">{{data.Ia}}A</cell>
      <cell title="Ib">{{data.Ib}}A</cell>
      <cell title="Ic">{{data.Ic}}A</cell>
      <cell title="In">{{data.In}}A</cell>
      <cell title="Ua">{{data.Ua}}V</cell>
      <cell title="Ub">{{data.Ub}}V</cell>
      <cell title="Uc">{{data.Uc}}V</cell>
      <cell title="PFa">{{data.PFa}}</cell>
      <cell title="PFb">{{data.PFb}}</cell>
      <cell title="PFc">{{data.PFc}}</cell>
    </group>
    <loading :show="showLoading" text="加载中..."></loading>
  </div>
</template>

<script>
import { Group, XButton, Cell, Loading } from "vux";
import Http from "./../unit/http.js";

export default {
  components: {
    Group,
    XButton,
    Cell, Loading
  },
  data() {
    return {
      showLoading:false,
      data: {}
    };
  },
  mounted() {
    this.getId();
  },
  watch:{
    data:function(){
      this.showLoading = false;
    }
  },

  methods: {
    getId() {
      const id = this.$route.query.id;
      this.getData(id);
    },

    back() {
      this.$router.go(-1);
    },

    getData(id) {
      this.showLoading = true;
      const self = this;
      const param = {
        id: id
      };
      const url = "/yitai/admin/areaData";
      const success = function(response) {
        
        self.data = response.data.info;
        
      };
      const failed = function() {
        
      };
      Http.http(url, param, success, failed);
    }
  }
};
</script>

<style scoped >
h3 {
  margin-bottom: 20px;
}
button.weui-btn {
  font-size: 18px;
}
.weui-btn_primary {
  background-color: #005e9c;
}
.weui-btn_primary:not(.weui-btn_disabled):active {
  color: rgba(255, 255, 255, 0.6);
  background-color: #034b7a;
}
.weui-btn_disabled.weui-btn_primary {
  background-color: #3978a1;
}

.cell-body  {
  padding: 0 2px;
}
.cell-body .weui-cells .weui-cell {
  font-size: 18px ;
}
</style>